package com.github.wxiaoqi.security.biz.biz;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.github.wxiaoqi.security.biz.entity.BhTaskTag;
import com.github.wxiaoqi.security.biz.mapper.BhTaskTagMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;

/**
 * 任务-标签关系表
 *
 * @author centerroot
 * @email lfw6699@163.com
 * @date 2018-05-18 10:24:30
 */
@Service
public class BhTaskTagBiz extends BaseBiz<BhTaskTagMapper,BhTaskTag> {
	/**
	 * 我的标签匹配悬赏
	 */
	public int queryTagReward(Map<String, Object> req) {
		String selfTag = (String) req.get("selfTag");
		if(null == selfTag || "".equals(selfTag)){
			return 0;
		}
        String[] selfTags = selfTag.split(",");
        List<String> list = new ArrayList<String>(Arrays.asList(selfTags));
		int count = mapper.getCountByTagDistinct(list);
		return count;
	}
}